package com.avalonsql.core.configs;

public class SettingsConfig extends Config {

/* TODO
    public enum KeywordCase {
        LOWERCASE(0);
        UPPERCASE(1);
        FIRSTLETTER(2);

        private int keywordCase;

        KeywordCase(int keywordCase) {
            this.keywordCase = keywordCase;
        }
    }
*/

    public static final int KEYWORDCASE_LOWER_CASE = 0;
    public static final int KEYWORDCASE_UPPER_CASE = 1;
    public static final int KEYWORDCASE_FIRST_LETTER = 2;

    protected static SettingsConfig instance = null;

    protected SettingsConfig() {
        super();
    }

    public static SettingsConfig getInstance() throws ConfigIOException {
        if (instance == null) {
            instance = new SettingsConfig();
            instance.reload();
        }
        return instance;
    }

    public int getKeywordCase() {
        return Integer.parseInt(getProperty("keywordCase"));
    }

    public void setKeywordCase(int keywordCase) {
        setProperty("keywordCase", String.valueOf(keywordCase));
    }

    public String getEditorFont() {
        return getProperty("editorFont");
    }

    public void setEditorFont(String ef) {
        setProperty("editorFont", ef);
    }

    public String getLookAndFeel() {
        return getProperty("lookAndFeel");
    }

    public void setLookAndFeel(String lookAndFeel) {
        setProperty("lookAndFeel", lookAndFeel);
    }

    public String getTheme() {
        return getProperty("theme");
    }

    public void setTheme(String theme) {
        setProperty("theme", theme);
    }


    public int getTabSize() {
        return Integer.parseInt(getProperty("tabSize"));
    }

    public void setTabSize(String ts) {
        setProperty("tabSize", ts);
    }

    public int getConnectionPoolSize() {
        return Integer.parseInt(getProperty("connectionPoolSize"));
    }

    public int getConnectionPoolMaxSize() {
        return Integer.parseInt(getProperty("connectionPoolMaxSize"));
    }

    public long getConnectionPoolExpiryTime() {
        return Long.parseLong(getProperty("connectionPoolExpiryTime"));
    }

    @Override
    public String getPropertiesFile() {
        return Const.DEFAULT_SETTINGS_CONFIG;
    }

}
